package com.zr.gdms.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.swing.text.html.HTMLDocument.HTMLReader.PreAction;

import com.zr.gdms.service.CourseService;
import com.zr.gdms.serviceimpl.CourseServiceImpl;

/**
 * @author  shichongming
 * @E-mail: 
 * @date 创建时间：2017年6月2日 下午4:58:51 
 * @version 1.0 
 * @parameter  
 * @since  
 * @return  
 */


//管理员通过cid修改课题信息
public class AdminUpdateCourseControllerSCM extends HttpServlet{
	CourseService c=new CourseServiceImpl();
	
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException {
	         doPost(req, resp);
}

	@Override
		protected void doPost(HttpServletRequest req, HttpServletResponse resp)
				throws ServletException, IOException {			
		req.setCharacterEncoding("utf-8");
		resp.setCharacterEncoding("utf-8");
		HttpSession session=req.getSession();
		String cname=req.getParameter("cname");
		System.out.println(cname);//////////
		String cstate=req.getParameter("cstate");
		System.out.println(cstate);//////////
		int tid=Integer.parseInt(req.getParameter("tid"));
		System.out.println(cstate);//////////
		int cid=Integer.parseInt(req.getParameter("cid"));
		System.out.println(cstate);//////////
		
		boolean flag=c.sAdminUpdateCourseByCid(cname, cstate, tid, cid);
		PrintWriter pw=resp.getWriter();
		if(flag){
			pw.write("1");
		}else{
			pw.write("0");
		}
		}
	
}
